package com.psdi.controller;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 * 游戏监听器类
 * 用于处理游戏中的各种事件
 */
public class GameListener implements KeyListener, MouseListener {
    @Override
    public void keyTyped(KeyEvent e) {
    }

    @Override
    public void keyPressed(KeyEvent e) {
        Input.setKey(e.getKeyCode(),true);
    }

    @Override
    public void keyReleased(KeyEvent e) {
        Input.setKey(e.getKeyCode(),false);
    }

    @Override
    public void mouseClicked(MouseEvent e) {

    }

    @Override
    public void mousePressed(MouseEvent e) {
        Input.setMouseButton(e.getButton(), true);Input.setMousePosition(e.getPoint(),e.getButton());
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        Input.setMouseButton(e.getButton(), false);
    }

    @Override
    public void mouseEntered(MouseEvent e) {
    }

    @Override
    public void mouseExited(MouseEvent e) {
    }
}
